package com.bao.interkont.server.impl;

import com.bao.interkont.mapper.ArticleMapper;
import com.bao.interkont.pojo.Article;
import com.bao.interkont.pojo.Result;
import com.bao.interkont.server.ArticleServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author bao*
 * @version 1.0
 */
@Component
public class ArticleServerImpl implements ArticleServer {
    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public void publishArticle(Article article) {
        articleMapper.publishArticle(article);
    }

    @Override
    public List<Article> getArticles() {
        return articleMapper.getArticles();
    }

    @Override
    public Article getArticleByArticleId(Integer articleId) {
        articleMapper.addArticleWatch(articleId);
        return articleMapper.getArticleByArticleId(articleId);
    }
}
